package com.red.controller;

import com.red.pojo.model.LoginBody;
import com.red.service.ILoginService;
import com.red.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private ILoginService loginService;

    @PostMapping("/login")
    public Result login(@RequestBody LoginBody loginBody) {
        return loginService.login(loginBody.getUserName(), loginBody.getPassword());
    }

    @GetMapping("/logout")
    private Result loginOut() {
        return Result.success();
    }
}
